package singleton;/** * @author Administrator * @Date: 2020/7/16 07:21 * @Description: 饿汉模式得单例模式:特点在于初始化类得时候，就创建了HungrySingleton实例。比较“饿” */public class HungrySingleton {    private static  HungrySingleton  hungrySingleton = new HungrySingleton();    public static HungrySingleton getHungrySingletonInstance(){        return hungrySingleton;    }    public static void main(String[] args) {        HungrySingleton instance1= HungrySingleton.getHungrySingletonInstance();        HungrySingleton instance2= HungrySingleton.getHungrySingletonInstance();        System.out.println(instance1==instance2);    }}